package com.ruoyi.web.cp.domain.rm;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
public class RmobDyMerge {
    private Long id;
    private String gameId;
    private Date date;
    private String league;
    private String teamA;
    private String teamB;
    private JSONArray details;
    private String detailsJson; // 新增字段用于存储 JSON 字符串

    private RmResult rmResult;

    public String getDetailsJson() {
        return JSON.toJSONString(this.details);
    }

    public JSONArray getDetailsArray() {
        return JSON.parseArray(this.detailsJson);
    }

    public RmobDyMerge(String gameId, Date date, String league, String teamA, String teamB) {
        this.gameId = gameId;
        this.date = date;
        this.league = league;
        this.teamA = teamA;
        this.teamB = teamB;
        this.details = new JSONArray();
    }

    @Data
    public static class Detail {
        private String score;
        private String rm_plv;
        private String ob_plv;

        public Detail(String score, String rm_plv, String ob_plv) {
            this.score = score;
            this.rm_plv = rm_plv;
            this.ob_plv = ob_plv;
        }
    }
}